package com.dodo.blog.server;

import com.dodo.blog.model.Tag;
import com.dodo.blog.request.BasicRequest;

import java.util.List;

/**
 * @author <a href="mailto:pohorelec@comvai.com">Jozef Pohorelec</a>
 */
public interface TagService
{
    /**
     * Return list of {@link Tag}
     *
     * @param request contains ordering and result properties
     * @return list of {@link Tag}
     */
    List<Tag> getTagList( BasicRequest request );

    /**
     * Save tag to datastore
     *
     * @param tag {@link Tag} entity to save
     */
    void saveTag( Tag tag );

    /**
     * Get tag by id
     *
     * @param id id of {@link Tag} entity
     * @return tag by id
     */
    Tag getTagById( Long id );

    /**
     * <p>Get tag by normalized name. Normalized name is lowercase dash replaced space version of name.</p>
     * <p>So name <em>Working with ie6 sucks</em> became <em>working-with-ie6-sucks</em></p>
     *
     * @param name normalized name of the tag
     * @return {@link Tag}
     */
    Tag getTagByNormalizedName( String name );

    /**
     * Delete tag from datastore
     *
     * @param id id of {@link Tag} entity to delete
     */
    void deleteTag( Long id );
}
